package 代码记录.Bit48天集训;

import java.util.*;

/**
 * 1.小易的升级之路
 * 2.找出字符串中第一个只出现一次的字符
 * @author zx
 * @create 2022-05-18 20:29
 */
public class day_22 {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        while(sc.hasNext()){
            int n = sc.nextInt();
            int a = sc.nextInt();
            int[] arr = new int[n];
            for(int i = 0;i < n;i++){
                arr[i] = sc.nextInt();
            }
            int res = a;
            for(int i = 0;i < n;i++){
                if(arr[i] <= res){
                    res += arr[i];
                }else{
                    res += gcd(res,arr[i]);
                }
            }
            System.out.println(res);
        }
    }
    private static int gcd(int a,int b){
        return b == 0 ? a : gcd(b,a % b);
    }

    /**
     * @param args 这吊炸天的代码通过率只有10%
     */
    public static void main2(String[] args){
        Scanner sc = new Scanner(System.in);
        String str = sc.nextLine();
        Map<Character,Integer> map = new TreeMap<>();
        for(int i = 0;i < str.length();i++){
            if(map.containsKey(str.charAt(i))){
                map.put(str.charAt(i),map.get(str.charAt(i)) + 1);
            }else{
                map.put(str.charAt(i),1);
            }
        }
        List<Character> list = new ArrayList<>();
        boolean flag = false;
        for(Map.Entry<Character,Integer> entry : map.entrySet()){
            if(entry.getValue() == 1){
                list.add(entry.getKey());
            }
        }
        if(list.size() == 0){
            System.out.println("-1");
        }
        for(int i = 0;i < str.length();i++){
            if(list.contains(str.charAt(i))){
                System.out.println(str.charAt(i));
            }
        }
    }
}
